<?php
include_once('admin/structures/tableEditors.php');
include_once('admin/structures/editorFields.php');

class adminTracks extends simpleTableEditor
{
    //construct games object
    function adminTracks()
    {
        global $lang;

        $this->simpleTableEditor(TRACKS_TABLE, 'tracks', 'AdminEditTracks',  $lang['AdminEditTracksInfo'], true, true);
        $this->addColumn(new fieldId('t_id'));
        $this->addColumn(new fieldTitle($lang['TrackName'],'t_fullTitle','',100));
        $this->addColumn(new fieldText($lang['TrackShortName'],'t_shortTitle','',3));
        $this->addColumn(new fieldText($lang['TrackLocation'],'t_location','',100));
        $this->addColumn(new fieldText($lang['TrackDownload'],'t_download','',100));
        $this->addColumn(new fieldText($lang['TrackEventNames'],'t_eventnames','',255));
        $this->addColumn(new fieldTableQueryComboBox($lang['Game'],'t_game','','SELECT g_id, g_name FROM ' . GAMES_TABLE . ' ORDER BY g_name ASC', 'g_id', 'g_name'));
        $logoThmb = new fieldDummy('t_logoThmb');
        $this->addColumn(new fieldImage($lang['Logo'],'t_logo','','tracks',200,150, false, true, $logoThmb, 80, 60));
        $this->addColumn($logoThmb);
        $this->doStuff();

    }

    //Overwrite Selection Function
    protected function getSelectionOptions()
    {
        return array("query" => 
            "SELECT t_id, t_fullTitle, g_name
             FROM " . TRACKS_TABLE . ", " . GAMES_TABLE . "
             WHERE t_game = g_id ORDER BY t_fullTitle ASC",
            "id" => "t_id", "text" => "t_fullTitle", "minor" => "g_name");
    }
}
?>
